#ifndef GUI_FORM_H
#define GUI_FORM_H

#include <vector>
#include <iostream>
#include "GUIElement.h"

/*
 * GUIForm is responsible for managing gui elements and their associations with
 * each other. As such, it is a class that makes keyboard/controller driven
 * input work with the GUI elements.
 *
 * Selection starts from whatever the first element is. It does not currently
 * take into consideration any currently active/hover element that was not
 * selected by this class.
 *
 * Actual binding of input is done outside of the class. Methods are provided
 * to trigger various actions that should be done with key presses.
 */

class GUIForm
{
    // Fields
    private:
        std::vector<GUIElement*> elements;
        int current;        // Currently selected element
        int pressedId;      // Element that the user initially pressed

    // Methods
    public:
        GUIForm();
        virtual ~GUIForm();
        void add(GUIElement* elem);  // Add a gui element
        void clear();       // Remove all element records
        // Actions to be binded to keys outside of this class
        void next();        // Select next element
        void previous();    // Select previous element
        void onPressed();   // Pass on "press" action for current element
        void onReleased();  // Pass on "release" action for current element
};

#endif
